pebble: panic on incorrect strict MemFS methods use#3098
Conversation
Before this fix, if someone calls SetIgnoreSyncs() on a non-strict MemFS, it does not unlock the mutex before returning. This causes all other methods of MemFS to deadlock.
Strict MemFS methods can be used by mistake on a non-strict MemFS. Panic if this happens, instead of (previously) ignoring this silently. This saves a test writer time being confused if they mis-use the type.
|
Review commit by commit is recommended. |
|
@jbowens PTAL |
|
There is one test failing on Windows, is this an unrelated flake? |
jbowens
left a comment
There was a problem hiding this comment.
Yeah, the Windows CI failure appears to be #1877 an unsquashed flake.
Should we instead expose a StrictMemFS type so that the type system prevents calling these methods? We could just export the methods on the MemFS, and expose a new StrictMemFS type that embeds the MemFS and exports the methods.
Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @pavelkalinnikov)
|
Good idea adding a new type, I can do in a follow-up. Alternatively, we may choose to make |
Strict
MemFSmethods can be used by mistake on a non-strictMemFS. Panic if this happens, instead of (previously) ignoring this silently. This saves a test writer time being confused if they mis-use the type.